package com.example.academicsystem.server.service.impl;

import com.example.academicsystem.pojo.dto.CourseDto;
import com.example.academicsystem.pojo.vo.CourseVo;
import com.example.academicsystem.result.PageResult;
import com.example.academicsystem.server.dao.CourseMapper;
import com.example.academicsystem.server.service.CourseService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CourseServiceImpl implements CourseService {
    @Autowired
    private CourseMapper courseMapper;

    @Override
    public PageResult coursePageQuery(CourseDto courseDto) {
        PageHelper.startPage(courseDto.getPage(),courseDto.getPageSize());
        Page<CourseVo> page = courseMapper.coursePageQuery(courseDto);
        return new PageResult(page.getTotal(),page.getResult());
    }
}
